package logger2.filter.gui;

import javax.swing.JLabel;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;

import logger2.environment.Environment;
import logger2.filter.Filter;

public class AcceptAllFilterPanel extends AbstractFilterPanel {
	private static final long serialVersionUID = -5039921203717289645L;
	Filter filter;
	
	public AcceptAllFilterPanel(Environment env) {
		super(env);
		
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[]{73, 303, 0};
		gridBagLayout.rowHeights = new int[]{14, 0, 0};
		gridBagLayout.columnWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
		gridBagLayout.rowWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
		setLayout(gridBagLayout);
		
		JLabel lblCeFiltreNe = new JLabel("Ce filtre ne peut pas \u00EAtre modifi\u00E9.");
		GridBagConstraints gbc_lblCeFiltreNe = new GridBagConstraints();
		gbc_lblCeFiltreNe.insets = new Insets(0, 0, 5, 5);
		gbc_lblCeFiltreNe.anchor = GridBagConstraints.NORTHWEST;
		gbc_lblCeFiltreNe.gridx = 0;
		gbc_lblCeFiltreNe.gridy = 0;
		add(lblCeFiltreNe, gbc_lblCeFiltreNe);
		
		JLabel lblNewLabel = new JLabel("Il accepte tous les messages.");
		GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
		gbc_lblNewLabel.insets = new Insets(0, 0, 0, 5);
		gbc_lblNewLabel.gridx = 0;
		gbc_lblNewLabel.gridy = 1;
		add(lblNewLabel, gbc_lblNewLabel);
	}

	@Override
	public void setModel(Filter model) {
		setVisible(model != null);
		filter = model;
	}

	@Override
	public Filter getModel() {
		return filter;
	}

}
